SpatialStream® Code Examples

Postal Code Identify

Using Postal Code Boundaries, GetByGeometry, and GetMap SpatialStream® components, you can display postal code boundaries in your mapping application and use server-side highlight techniques to provide identify functionality. This example will demonstrate how to display postal boundaries and add highlight behavior with information return in a balloon. The Postal Code Boundaries component gives you access to nationwide postal code boundaries. The GetByGeometry component returns features at the mouse-click location, and GetMap displays the boundaries and the identified feature.

The advantage of the server-side highlight technique is that it gives you highly responsive interactivity with complex features and/or large data sets.

Postal Code Boundaries | GetMap | GetByGeometry

// add postalcode layer using a basic map SLD definition
var postalcode = new Dmp.Layer.WMSLayer("boundary", "SS", {
antiAlias: true
});
postalcode.addChild("postalcodePoly", "DMP_LICENSE/POSTALCODE", "$(ACCOUNT_FOLDER)SLD/SimpleBoundary.sld.xml", {
zoomRange: {
min: 7, max: 19
}
});
postalcode.addChild("postalcodeLabel", "DMP_LICENSE/POSTALCODE", "$(ACCOUNT_FOLDER)SLD/PostalCodeLabel.sld.xml", {
zoomRange: {
min: 10, max: 19
}
});
map.addLayer(postalcode);

//----------------

// we use the _DMP_ID to identify the record that was clicked on
var keyValue = records[0]["_DMP_ID"];
var postcode = records[0]["POSTCODE"];

//----------------

// add the server side highlight layer
var highlightLayer = new Dmp.Layer.WMSLayer("highlightLayer", "SS",
{
showField: "_DMP_ID", showValues: keyValue, antiAlias: true, ignoreHoles: true
});
highlightLayer.addChild("highlightResource", recordSet.datasource, "$(ACCOUNT_FOLDER)SLD/AdminIdentify.sld.xml",
{
zoomRange: {
min: 1, max: 19
}
});
map.addLayer(highlightLayer);


Run Sample   View Video   Back To Index